cmake_minimum_required(VERSION 3.4.1)

#aux_source_directory(src/main/jni/live/UsageEnvironment DIR_LIB_SRCS_UE)
#aux_source_directory(src/main/jni/live/BasicUsageEnvironment DIR_LIB_SRCS_BUE)
#aux_source_directory(src/main/jni/live/groupsock DIR_LIB_SRCS_GS)
#aux_source_directory(src/main/jni/live/liveMedia DIR_LIB_SRCS_LM)

add_definitions(-DSOCKLEN_T=socklen_t)
add_definitions(-DNO_SSTREAM=1)
add_definitions(-DNEWLOCALE_NOT_USED)
#add_definitions(-D_LARGEFILE_SOURCE=1)
#add_definitions(-D_FILE_OFFSET_BITS=64)
add_definitions(-DBSD=1)

include_directories(src/main/jni/include)
include_directories(src/main/jni/live/UsageEnvironment/include)
include_directories(src/main/jni/live/BasicUsageEnvironment/include)
include_directories(src/main/jni/live/groupsock/include)
include_directories(src/main/jni/live/liveMedia/include)

file(GLOB BasicUsageEnvironmentFiles
	src/main/jni/live/BasicUsageEnvironment/*.cpp)
add_library(BasicUsageEnvironment
			${BasicUsageEnvironmentFiles})

file(GLOB groupsockfiles
	src/main/jni/live/groupsock/*.cpp src/main/jni/live/groupsock/*.c)
add_library(groupsock ${groupsockfiles})

file(GLOB liveMediaFiles
		src/main/jni/live/liveMedia/*.hh src/main/jni/live/liveMedia/*.cpp src/main/jni/live/liveMedia/*.c)
add_library(liveMedia ${liveMediaFiles})

file(GLOB UsageEnvironmentFiles
    src/main/jni/live/UsageEnvironment/*.cpp)
add_library(UsageEnvironment ${UsageEnvironmentFiles})

add_library( rtsp
             SHARED
             src/main/jni/rtsp.cpp
             src/main/jni/DeviceSource1.cpp)


find_library(log-lib
              log )

target_link_libraries( rtsp
                       ${log-lib}
                       liveMedia
                       groupsock
                       BasicUsageEnvironment
                       UsageEnvironment )